package cn.crm.dao;

import cn.crm.pojo.SalChance;
import cn.crm.pojo.SalPlan;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface SalPlanDao extends BaseMapper<SalPlan> {
    @Select("SELECT * FROM sal_plan p JOIN sal_chance c ON p.`pla_chc_id`=c.`chc_id`")
    @Results({
            @Result(property = "salChance",column = "pla_chc_id",
            javaType = SalChance.class,
            one = @One(select = "cn.crm.dao.SalChanceDao.selectById"))
    })
    Page<SalPlan> getSalPlanPageJoinSalChance(Page page);
    @Select("SELECT * FROM sal_plan p WHERE pla_chc_id=#{chcId}")
    List<SalPlan> getSalPlanListByChcId(@Param("chcId") Integer chcId);
}
